package com.shfl.a;

import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;

 class Person {
    String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    //包含一个带参的构造器和一个不带参的构造器
    public Person(String name, int age) {
        super();
        this.name = name;
        this.age = age;
    }

    public Person() {
        super();
    }

}

class ReflactionTest {

    public static void main(String[] args) {
        Class clazz = null;
        clazz = Person.class;
        Field[] fields = clazz.getDeclaredFields();
        for (Object obj : fields) {
            System.out.println(obj);
        }
    }
}

class ReflectionTest1 {

    public static void main(String[] args) {
        Class clazz = null;
        clazz = Person.class;

        Person person = new Person();
        clazz = person.getClass();
        try {
            clazz = Class.forName("com.shfl.a.Person");

        } catch (ClassNotFoundException e) {
            e.getMessage();
        }

        System.out.print(clazz.getName());
        ;
    }
}
class tttt{
     public tttt(){

     }

     public void test(){
         Object obj = this.getClass().getClassLoader();
         InputStream in = this.getClass().getClassLoader().getResourceAsStream("test4.txt");
         try{
             int l =in.read();

         }catch (IOException e){

         }



     }
}
class readfile{
    public static void main(String[] args) {
        tttt tttt = new tttt();
        tttt.test();
    }


}
